﻿@model iMyRestaurent.Models.LocationModel
@{
    
    switch (Model.Mode)
    {
        case iMyRestaurent.Shared.Mode.Create:
        case iMyRestaurent.Shared.Mode.CreateAfterRegistering:
            ViewBag.Title = "iMyRestaurant - Create New Location";
            ViewBag.NextAction = Url.Action("Create", "Layout");
            ViewBag.BackAction = Url.Action("Index", "Summary");
            break;
        case iMyRestaurent.Shared.Mode.CreateFromLocationList:
            ViewBag.Title = "iMyRestaurant - Create New Location";
            ViewBag.NextAction = Url.Action("Create", "Layout");
            ViewBag.BackAction = Url.Action("EditLocation", "Location");
            break;
        case iMyRestaurent.Shared.Mode.EditFromLocation:
            ViewBag.Title = "iMyRestaurant - Edit Location " + Model.LocationName;
            ViewBag.NextAction = Url.Action("Edit", "Layout");
            ViewBag.BackAction = Url.Action("EditLocation", "Location");
            break;
    }

    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section import {
    @NoCache.Instance.Css(Url, "~/Content/location.css")
}
<div id="title">@ViewBag.Title</div>
<div class="opacity-box center-box" style="width: 900px; margin-top: 20px;">
    <div style="padding: 20px;">
        <p>
            Please provide your restaurant’s location name and select the number of tables and
            chairs that you want to configure. (All values can be changed later if needed)
        </p>
        <div class="clearfix" style="padding-top: 40px;">
            <div class="left input-label">
                @Html.LabelFor(model => model.LocationName)
            </div>
            <div class="left" style="margin-left: 30px;">
                @Html.TextBoxFor(model => model.LocationName, new { size = "50", value = Model.LocationName })
            </div>
        </div>
        <div style="padding-top: 40px;">
            <text>Quick table create selection</text>
        </div>
        <table id="table" cellpadding="0" cellspacing="0">
            <thead>
                <tr align="center">
                    <td width="198px">
                        <div>
                            <text>No of Chairs at table</text>
                        </div>
                    </td>
                    <td colspan="2">
                        <div>
                            <text>How many tables do you need to create in this new location?</text>
                        </div>
                    </td>
                </tr>
            </thead>
            <tbody>
                @foreach (var table in Model.Tables)
                {
                    <tr>
                        <td>
                            <input type="text" class="txt-chair" value="@table.ChairNo" />
                        </td>
                        <td>
                            <input type="text" class="txt-table" value="@(table.TableNo == 0 ? "?" : table.TableNo.ToString())" />
                        </td>
                        <td>
                            <button type="button" class="image-button button-delete">
                            </button>
                        </td>
                    </tr>
                }
            </tbody>
        </table>
        <button type="button" class="center-box image-button button-add">
        </button>
    </div>
</div>
@section footer {
    @if (Model.Mode != iMyRestaurent.Shared.Mode.CreateAfterRegistering)
    {
        <button type="button" class="image-button button-back left">
        </button>
    }
    <button type="button" class="image-button button-continue right">
    </button>
    <form action="@ViewBag.BackAction" method="post" id="back">
    <input type="hidden" name="Mode" value="@Model.Mode" />
    <input type="hidden" name="SummaryLocationID" value="@Model.SummaryLocationID" />
    <input type="hidden" name="SummaryDate" value="@Model.SummaryDate" />
    <input type="hidden" name="LocationID" value="@Model.SummaryLocationID" />
    <input type="hidden" name="Date" value="@Model.SummaryDate" />
    </form>
    <form action="@ViewBag.NextAction" method="post" id = "next">
    <input type="hidden" name="LocationID" value="@Model.LocationID" id="location-id" />
    <input type="hidden" name="Mode" value="@(Model.Mode)" />
    <input type="hidden" name="LocationName" id="location-name" />
    <input type="hidden" name="TableText" id="txt-table-summary" value="@Model.TableText" />
    <input type="hidden" name="SummaryDate" value="@Model.SummaryDate" />
    <input type="hidden" name="Date" value="@Model.SummaryDate" />
    <input type="hidden" name="SummaryLocationID" value="@(Model.Mode == iMyRestaurent.Shared.Mode.Create ? Model.SummaryLocationID : Model.LocationID.ToString())" />
    <input type="hidden" name="LayoutZoomScale" value="@Model.LayoutZoomScale" />
    </form>
}
@section script {
    @NoCache.Instance.Javascript(Url, "~/Scripts/location.js")
    </script>
}
